package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpReportsScorecardFailureAnalysisbyAssetPageUtil extends SeleniumPageUtil {
	
	public final static By RSFA_SPAN_CHANGE_SCOPE 	= By.id("ctl44_lblChangeScope");
	// elements under Change Scope
	public final static By RSFA_DIV_RESULTS	 		= By.id("ctl44_popFailureAnalysis");
	
	public final static By RSFA_TD_HEADER 			= By.xpath("//*[@id='form1']/table/tbody/tr[2]/td/div/table/tbody/tr/td[3]");
	public final static By RSFA_SPAN_INCIDENTS 		= By.id("ctl44_lblSubject");
	public final static By RSFA_SPAN_NUM_RECORDS 	= By.id("ctl44_lblNumRecs");
	public final static By RSFA_SPAN_SCOPE 			= By.id("ctl44_lblScope");
	public final static By RSFA_TD_UNIT_SERIAL_NO 	= By.xpath("//*[@id='tblResults']//td[text()='Unit Serial Number']");
	public final static By RSFA_TD_UNIT_DESCRIPTION = By.xpath("//*[@id='tblResults']//td[text()='Unit Description']");
	public final static By RSFA_TD_CUSTOMER_NAME 	= By.xpath("//*[@id='tblResults']//td[text()='Customer Name']");
	public final static By RSFA_TD_BACKUP 			= By.xpath("//*[@id='tblResults']//td[text()='BACKUP']");
	public final static By RSFA_TD_BATTERY 			= By.xpath("//*[@id='tblResults']//td[text()='Battery']");
	public final static By RSFA_TD_CONFIGURE 		= By.xpath("//*[@id='tblResults']//td[text()='Configure']");
	public final static By RSFA_TD_CONTROLLER 		= By.xpath("//*[@id='tblResults']//td[text()='Controller']");
	public final static By RSFA_TD_DRIVEERROR 		= By.xpath("//*[@id='tblResults']//td[text()='DriveError']");
	public final static By RSFA_TD_DRIVEFAIL	 	= By.xpath("//*[@id='tblResults']//td[text()='DriveFail']");
	public final static By RSFA_TD_DRIVEFAULT 		= By.xpath("//*[@id='tblResults']//td[text()='DriveFault']");
	public final static By RSFA_TD_EMAILALERT 		= By.xpath("//*[@id='tblResults']//td[text()='EmailAlert']");
	public final static By RSFA_TD_FANFAILURE	 	= By.xpath("//*[@id='tblResults']//td[text()='FanFailure']");
	public final static By RSFA_TD_LABTOP	 		= By.xpath("//*[@id='tblResults']//td[text()='Laptop']");
	public final static By RSFA_TD_MONITOR	 		= By.xpath("//*[@id='tblResults']//td[text()='Monitor']");
	public final static By RSFA_TD_NOCOMMS	 		= By.xpath("//*[@id='tblResults']//td[text()='NoComms']");
	public final static By RSFA_TD_NOSCREEN 		= By.xpath("//*[@id='tblResults']//td[text()='NoScreen']");
	public final static By RSFA_TD_PS	 			= By.xpath("//*[@id='tblResults']//td[text()='PS']");
	public final static By RSFA_TD_SYSCHECK	 		= By.xpath("//*[@id='tblResults']//td[text()='SysCheck']");
	public final static By RSFA_TD_SYSERR 			= By.xpath("//*[@id='tblResults']//td[text()='SysErr']");
	public final static By RSFA_TD_SYSHUNG 			= By.xpath("//*[@id='tblResults']//td[text()='SysHung']");
	public final static By RSFA_TD_SYSLOGS 			= By.xpath("//*[@id='tblResults']//td[text()='SysLogs']");
	public final static By RSFA_TD_TAPEERR 			= By.xpath("//*[@id='tblResults']//td[text()='TapeErr']");
	public final static By RSFA_TD_UNKNOWN 			= By.xpath("//*[@id='tblResults']//td[text()='Unknown']");
	public final static By RSFA_TD_VISIT 			= By.xpath("//*[@id='tblResults']//td[text()='Visit']");
	public final static By RSFA_TD_TOTAL 			= By.xpath("//*[@id='tblResults']//td[text()='Total']");
	public final static By RSFA_TD_GRAND_TOTAL	 	= By.xpath("//*[@id='tblResults']/tbody/tr[last()]/td[1]");
	
	public static void enterReportsScorecardFailureAnalysisbyAssetPage() {
		SpHomePageUtil.enter();
		SpHomePageUtil.enterReportsDefaultPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpReportsDefaultPageUtil.RD_LINK_FAILURE_ANALYSIS_BY_ASSET));
		waitForPageToLoad();
	}
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_REPORTS_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				RSFA_SPAN_SCOPE, RSFA_TD_GRAND_TOTAL
			});
		
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RSFA_SPAN_SCOPE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RSFA_TD_GRAND_TOTAL));
	}
}
